import Router from 'vue-router'
Vue.use(Router)


// 解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;

// push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};

//replace
Router.prototype.replace = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalReplace.call(this, location, onResolve, onReject);
  return originalReplace.call(this, location).catch(err => err);
};


export default new Router({
	mode: 'history',
	base: '/hou',

	routes: [
    {
      path: '/',
      redirect:'/bisai'
    },

    {
        path: '/login',
        component: () => import('@/esports/denglu/index'),
        mete:{
          title:"注册登录",
        }
    },

    {
    	path: '/bisai',
      component: () => import('@/esports/bisai/index'),
      redirect:'/bisai',
      children:[
        {
          path: '/bisai',
          component: () => import('@/esports/bisai/list'),
          mete:{
            title:"比赛列表",
          },
        },
        {
          path: '/bisai/detail',
          component: () => import('@/esports/bisai/detail'),
          mete:{
            title:"比赛详情",
          },
        },
        {
          path: '/bisai/mingdan',
          component: () => import('@/esports/bisai/mingdan'),
          mete:{
            title:"报名名单",
          },
        },
        {
          path: '/bisai/chengji',
          component: () => import('@/esports/bisai/chengji'),
          mete:{
            title:"比赛成绩",
          },
        },
      ]
    },
    {
    	path: '/dingdan',
      component: () => import('@/esports/dingdan/index'),
      redirect:'/dingdan/dingdan',
      children:[
        {
          path: '/dingdan/dingdan',
          component: () => import('@/esports/dingdan/list'),
          mete:{
            title:"订单列表",
          },
        }
      ]
    },
    {
    	path: '/yaoqing',
      component: () => import('@/esports/yaoqing/index'),
      redirect:'/yaoqing/yaoqing',
      children:[
        {
          path: '/yaoqing/yaoqing',
          component: () => import('@/esports/yaoqing/list'),
          mete:{
            title:"分销统计",
          },
        }
      ]
    },
    {
    	path: '/huigu',
      component: () => import('@/esports/huigu/index'),
      redirect:'/huigu',
      children:[
        {
          path: '/huigu',
          component: () => import('@/esports/huigu/lanmu'),
          mete:{
            title:"栏目管理",
          },
        },
        {
          path: '/huigu/huigu',
          component: () => import('@/esports/huigu/list'),
          mete:{
            title:"赛事回顾列表",
          },
        },
        {
          path: '/huigu/detail',
          component: () => import('@/esports/huigu/detail'),
          mete:{
            title:"赛事回顾详情",
          },
        },
      ]
    },
    {
    	path: '/renyuan',
      component: () => import('@/esports/renyuan/index'),
      redirect:'/renyuan/renyuan',
      children:[
        {
          path: '/renyuan/renyuan',
          component: () => import('@/esports/renyuan/list'),
          mete:{
            title:"人员列表",
          },
        }
      ]
    },
    {
    	path: '/xinwen',
      component: () => import('@/esports/xinwen/index'),
      redirect:'/xinwen',
      children:[
        {
          path: '/xinwen',
          component: () => import('@/esports/xinwen/lanmu'),
          mete:{
            title:"栏目管理",
          },
        },
        {
          path: '/xinwen/xinwen',
          component: () => import('@/esports/xinwen/list'),
          mete:{
            title:"新闻列表",
          },
        },
        {
          path: '/xinwen/detail',
          component: () => import('@/esports/xinwen/detail'),
          mete:{
            title:"新闻详情",
          },
        },
      ]
    },
    {
    	path: '/xiazai',
      component: () => import('@/esports/xiazai/index'),
      redirect:'/xiazai',
      children:[
        {
          path: '/xiazai',
          component: () => import('@/esports/xiazai/lanmu'),
          mete:{
            title:"下载列表",
          },
        }
      ]
    },
    {
    	path: '/guanyuwomen',
      component: () => import('@/esports/guanyuwomen/index'),
      redirect:'/guanyuwomen',
      children:[
        {
          path: '/guanyuwomen',
          component: () => import('@/esports/guanyuwomen/lanmu'),
          mete:{
            title:"栏目管理",
          },
        }
      ]
    },
    
    {
    	path: '/qudaoguanli',
      component: () => import('@/esports/qudaoguanli/index'),
      redirect:'/qudaoguanli',
      children:[
        {
          path: '/qudaoguanli',
          component: () => import('@/esports/qudaoguanli/lanmu'),
          mete:{
            title:"渠道管理",
          },
        }
      ]
    },



	]
})
